<template>
	<view class="page_bill">
		<nav-bar title="佣金明细"></nav-bar>
        <!-- 公共组件-每个页面必须引入 -->
        <public-module></public-module>
        <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
            <view class="bill_item" v-for="(item,index) of profitBillList" :key="index">
                <view class="head_info">
                    <!-- <text class="name">财务编号：{{item.financeNo}}</text> -->
                    <text class="price">{{item.type}}({{item.recommendName}})</text>
                </view>
                <view class="content">
                    <view>
                        <text>金额：</text>
                        <text>{{item.rateMoneyStr}}元</text>
                    </view>
                    <view>
                        <text>日期：</text>
                        <text>{{item.createTime}}</text>
                    </view>
                </view>
            </view>
        </mescroll-body>
	</view>
</template>

<script>
import MescrollMixin from "@/components/common/mescroll-uni/mescroll-mixins.js";
    export default {
    	mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
	data() {
		return {
			downOption: {
				auto: false //是否在初始化后,自动执行downCallback; 默认true
			},
			profitBillList:[],
		};
	},
	//第一次加载
	onLoad(e) {
	},
	//页面显示
	onShow() {},
	//方法
	methods: {
        /*下拉刷新的回调 */
        downCallback() {
        	//联网加载数据
        	this.loadData(1);
        },
        /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
        upCallback(page) {
        	//联网加载数据
        	this.loadData(page.num);
        },
        loadData(pageNo) {
            let httpData = {
                pageNo: pageNo,
                pageSize: 15,
            };
            this.$http
            	.post('api/mime/wallet/v1/rate_money_record', httpData,{
            		load:false
            	}).then(res => {
            		uni.stopPullDownRefresh();
            		//方法一(推荐): 后台接口有返回列表的总页数 totalPage
            		this.mescroll.endByPage(res.data.length, res.pages); //必传参数(当前页的数据个数, 总页数)
            		
            		if (pageNo == 1) {
            			this.profitBillList = res.data;
            		} else {
            			this.profitBillList = this.profitBillList.concat(res.data);
            		}
            	}).catch(() => {
            		//联网失败, 结束加载
            		this.mescroll.endErr();
            	});
        },
		onPageJump(url) {
			uni.navigateTo({
				url: url
			});
		}
	},
	//页面隐藏
	onHide() {},
	//页面卸载
	onUnload() {},
	//用户点击分享
	onShareAppMessage(e) {
		return this.wxShare();
	}
};
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
.page_bill {
	background-color: #F5f5f5;
	min-height: 100vh;
	padding: 30rpx;
	.bill_item {
		background-color: #ffffff;
		border-radius: 8rpx;
		padding: 0 30rpx;
		margin-bottom: 20rpx;
		.head_info {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 30rpx 0;
			border-bottom: 2rpx solid #e5e5e5;
			.name {
				font-size: 28rpx;
				color: #333333;
			}
			.price {
				font-size: 28rpx;
				color: #ff3d3d;
			}
		}
		.content {
			padding: 20rpx 0;
			view {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 20rpx 0;
				font-size: 28rpx;
				color: #555555;
			}
		}
	}
}
</style>
